﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entity.Framework;

namespace Business.Operations
{
    public class RolOperation
    {
        private static HPDMASEntities db = new HPDMASEntities();

        public RolOperation()
        {

        }

        public static List<Rol> RolGetAll()
        {
            var rolListesi = db.Rol.ToList();
            return rolListesi;
        }

        public static Rol RolGetByRolId(int rolId)
        {
            var rol = (from c in db.Rol where c.RolID == rolId select c).First();
            return rol;
        }

        public static int RolIdGetByRolAdi(string rolAdi)
        {
            var rolId = (from c in db.Rol where c.RolAdi == rolAdi select c.RolID).First();
            return rolId;
        }

        public static string RolAdiGetByRolId(int rolId)
        {
            var rolAdi = db.Rol.
                Where(c => c.RolID == rolId).
                Select(c => c.RolAdi).FirstOrDefault();
            return rolAdi;
        }
    }
}
